import pandas as pd
import numpy as np

df = pd.DataFrame({'num1':[1,np.nan,3],'num2':[4,5,np.nan],'num3':[7,8,9]})
print(df.isnull())
print(df.dropna())#删除空值
print(df.dropna(thresh=1))
result = df.stack()
print(result)

# 修正第10-12行的语法
df1 = pd.DataFrame(
    data=[[12,34,34,33],[23,44,25,42]],
    index=['男生人数','女生人数'],
    columns=[['a','a','c','c'],['v','n','v','n']]  # 这里是多层列索引的正确格式
)

print(df1.stack())